﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MetroIoc
{
    public interface IContainer
    {
        IContainer Register<T>(string key = null, IRegistration registration = null);
        IContainer Register<T>(Type toType, string key = null, IRegistration registration = null);
        IContainer Register<TFrom, TTo>(string key = null, IRegistration registration = null) where TTo : TFrom;
        IContainer Register(Type fromType, Type toType, string key = null, IRegistration registration = null);

        IContainer RegisterInstance<TInterface>(TInterface instance, string key = null);
        IContainer RegisterInstance(Type toType, object instance, string key = null);

        T Resolve<T>(string key = null);
        T TryResolve<T>(string key = null) where T : class;
        object Resolve(Type toType, string key = null);
        object TryResolve(Type toType, string key = null);

        IEnumerable<T> ResolveAll<T>();
        IEnumerable<object> ResolveAll(Type toType);

        void BuildUp(object instance);

        IConfiguration GetConfiguration();

        IContainer CreateChildContainer();
    }
}
